package com.lottery.dao;

import com.lottery.dto.AppOrdersOutputDTO;
import com.lottery.dto.TotalCheckOutputDTO;
import com.lottery.dto.OrdersAndBetNumbersDTO;
import com.lottery.pojo.TableBetNumbers;
import com.lottery.pojo.TableOrders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface OrderDao {

    List<TableOrders> getAllOrders();

    List<OrdersAndBetNumbersDTO> getPureOrders(String machine_number, String serial_number, String startTime, String endTime);

    List<TableOrders> getPureOrdersByDate(String date);

    List<OrdersAndBetNumbersDTO> getPureOrdersBySerialNumber(String serial_number);

    List<OrdersAndBetNumbersDTO> getPureBetNumbers(@Param("numbers") List<OrdersAndBetNumbersDTO> numbers);

    List<OrdersAndBetNumbersDTO> getOrders(String bet_number, String machine_number, String serial_number, Integer is_winner, String startTime, String endTime, String belong_to, String b_is_winner, String checked_winning);

    List<OrdersAndBetNumbersDTO> getOrdersW(String bet_number, String machine_number, String serial_number, Integer is_winner, String startTime, String endTime, String b1, String b2, String b3, String b4, String b_is_winner, String checked_winning);

    List<TableBetNumbers> getBetsByDate(String startTime, String endTime, String bet_number);

    List<OrdersAndBetNumbersDTO> getOrdersByMachineNumber(String machine_number, String startTime, String endTime);

    int deleteOrderById(int id);

    int deleteOrderBySerialNumber(String serial_number);

    void deleteOrderByDateRange(String startTime, String endTime);

    void deleteBetByDateRange(String startTime, String endTime);

    List<TotalCheckOutputDTO> getTotalCheck();


    List<AppOrdersOutputDTO> appGetOrders(String machine_number, String serial_number, Integer is_winner, String startTime, String endTime);

    void updateOrderPaid(String id, String paid_at);

    void insertOrder(@Param("o") TableOrders order);

    void insertBetNumber(@Param("b") TableBetNumbers number);

    ///
    List<TableOrders> getOrdersByDate(int is_deleted, String startTime, String endTime);

    List<TableBetNumbers> getBetsByOrderId(int order_id);

    void updateBet(int order_id);

    void updateOrder(int id);

    List<TableOrders> getOrderByDeletedAndBelong(String region_key);

    List<TableBetNumbers> getBets432(int order_id, int is_pool, String bet_number, String startTime, String endTime);

    void updateBet432(int order_id, int rank, double prizes, String winning_payment_time);

    TableOrders getOrderById(int id);

    void updateOrder432(int id, double total_winning_amount);
}
